package com.ruoyi.system.service.impl;
import com.ruoyi.system.domain.KeyPersonnelAdminType;
import com.ruoyi.system.mapper.KeyPersonnelAdminTypeMapper;
import com.ruoyi.system.service.KeyPersonnelAdminTypeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 两类重点人员类型表 服务实现类
 * </p>
 * @since 2023-03-15
 */
@Service
public class KeyPersonnelAdminTypeServiceImpl implements KeyPersonnelAdminTypeService {
    @Resource
    private KeyPersonnelAdminTypeMapper keyPersonnelAdminTypeMapper;

    @Override
    public List<KeyPersonnelAdminType> queryByPage(KeyPersonnelAdminType keyPersonnelAdminType) {
        return keyPersonnelAdminTypeMapper.queryAllByLimit(keyPersonnelAdminType);
    }

    @Override
    public KeyPersonnelAdminType queryById(Integer id) {
        return keyPersonnelAdminTypeMapper.queryById(id);
    }

    @Override
    public List<KeyPersonnelAdminType> queryByPId(Integer id) {
        return keyPersonnelAdminTypeMapper.queryByPId(id);
    }

    @Override
    public KeyPersonnelAdminType insert(KeyPersonnelAdminType keyPersonnelAdminType) {
        //keyPersonnelAdminType.setCreateUser(SecurityUtils.getUsername());
        this.keyPersonnelAdminTypeMapper.insert(keyPersonnelAdminType);
        return keyPersonnelAdminType;
    }

    @Override
    public KeyPersonnelAdminType update(KeyPersonnelAdminType keyPersonnelAdminType) {
        this.keyPersonnelAdminTypeMapper.update(keyPersonnelAdminType);
        return this.queryById(keyPersonnelAdminType.getId());
    }

    @Override
    public boolean deleteById(Integer id) {
        return keyPersonnelAdminTypeMapper.deleteById(id) > 0;
    }
}
